package com.yaozheng.vocationaltraining.view.paper;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.yaozheng.vocationaltraining.R;
import com.yaozheng.vocationaltraining.dialog.interfaces.BaseDialogEventProcess;

import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EViewGroup;
import org.androidannotations.annotations.ViewById;

/**
 * 考试帮助卡.
 */
@EViewGroup(R.layout.view_dialog_exam_help)
public class ExamHelpView extends LinearLayout {
    @ViewById
    TextView examOvertimeCardsTextView, examAlertTextView;

    BaseDialogEventProcess baseDialogEventProcess;

    public ExamHelpView(Context context) {
        super(context);
    }

    public ExamHelpView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public void setBaseDialogEventProcess(BaseDialogEventProcess baseDialogEventProcess) {
        this.baseDialogEventProcess = baseDialogEventProcess;

    }

    public void setChildWidth(int width) {
        if (width > 10) {
            LayoutParams layoutParams = new LayoutParams(width, LayoutParams.WRAP_CONTENT);
            examOvertimeCardsTextView.setLayoutParams(layoutParams);

            LayoutParams layoutParams2 = new LayoutParams(width, LayoutParams.WRAP_CONTENT);
            examAlertTextView.setLayoutParams(layoutParams2);
        }
    }

    @Click({R.id.examOvertimeCardsTextView, R.id.examAlertTextView})
    public void clickTag(View view) {
        if (baseDialogEventProcess != null) {
            baseDialogEventProcess.runMethod(String.valueOf(view.getTag()));
        }
    }

}
